﻿// Version:1
// Author:Sanket Naik
// Date:July-21-2010 
// Comments:
// 
// 
// 

using System;
using System.Linq;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Runtime.Serialization;
using ManagedServices.Common.DataTransferObject;
using System.ComponentModel;

namespace ManagedServices.DataTransferObjects
{
    /// <summary>
    /// The DTO representing a dependency for a Sub Service 
    /// </summary>
    [DataContract]
    [global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Msf_Tbl_Dependency")]
    public partial class Dependency : INotifyPropertyChanging, INotifyPropertyChanged, ICommonDto
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private System.Guid _Msf_Col_DependencyID;

        private short _Msf_Col_DependencyType;

        private string _Msf_Col_DependencyName;

        private System.Data.Linq.Binary _Msf_Col_DependencyRawData;

        private System.Guid _Msf_Col_SubServiceID;

        private string _Msf_Col_Version;

        private System.Guid _Msf_Col_CreatedBy;

        private System.Nullable<System.Guid> _Msf_Col_ModifiedBy;

        private System.DateTime _Msf_Col_CreatedOn;

        private System.Nullable<System.DateTime> _Msf_Col_ModifiedOn;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnDependencyIDChanging(System.Guid value);
        partial void OnDependencyIDChanged();
        partial void OnDependencyTypeChanging(short value);
        partial void OnDependencyTypeChanged();
        partial void OnDependencyNameChanging(string value);
        partial void OnDependencyNameChanged();
        partial void OnDependencyRawDataChanging(System.Data.Linq.Binary value);
        partial void OnDependencyRawDataChanged();
        partial void OnSubServiceIDChanging(System.Guid value);
        partial void OnSubServiceIDChanged();
        partial void OnVersionChanging(string value);
        partial void OnVersionChanged();
        partial void OnCreatedByChanging(System.Guid value);
        partial void OnCreatedByChanged();
        partial void OnModifiedByChanging(System.Nullable<System.Guid> value);
        partial void OnModifiedByChanged();
        partial void OnCreatedOnChanging(System.DateTime value);
        partial void OnCreatedOnChanged();
        partial void OnModifiedOnChanging(System.Nullable<System.DateTime> value);
        partial void OnModifiedOnChanged();
        #endregion

        public Dependency()
        {
            OnCreated();
        }

        /// <summary>
        /// The Guid representing the Dependency Type Uniquely
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name="Msf_Col_DependencyID", Storage = "_Msf_Col_DependencyID", DbType = "UniqueIdentifier NOT NULL", IsPrimaryKey = true)]
        public System.Guid DependencyID
        {
            get
            {
                return this._Msf_Col_DependencyID;
            }
            set
            {
                if ((this._Msf_Col_DependencyID != value))
                {
                    this.OnDependencyIDChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_DependencyID = value;
                    this.SendPropertyChanged("DependencyID");
                    this.OnDependencyIDChanged();
                }
            }
        }

        /// <summary>
        /// The type of dependency
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_DependencyType", Storage = "_Msf_Col_DependencyType", DbType = "SmallInt NOT NULL")]
        public short DependencyType
        {
            get
            {
                return this._Msf_Col_DependencyType;
            }
            set
            {
                if ((this._Msf_Col_DependencyType != value))
                {
                    this.OnDependencyTypeChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_DependencyType = value;
                    this.SendPropertyChanged("DependencyType");
                    this.OnDependencyTypeChanged();
                }
            }
        }

        /// <summary>
        /// The name of the dependency
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name="Msf_Col_DependencyName", Storage = "_Msf_Col_DependencyName", DbType = "NVarChar(250) NOT NULL", CanBeNull = false)]
        public string DependencyName
        {
            get
            {
                return this._Msf_Col_DependencyName;
            }
            set
            {
                if ((this._Msf_Col_DependencyName != value))
                {
                    this.OnDependencyNameChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_DependencyName = value;
                    this.SendPropertyChanged("DependencyName");
                    this.OnDependencyNameChanged();
                }
            }
        }

        /// <summary>
        /// The dependency
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_DependencyRawData", Storage = "_Msf_Col_DependencyRawData", DbType = "VarBinary(MAX) NOT NULL", CanBeNull = false, UpdateCheck = UpdateCheck.Never)]
        public System.Data.Linq.Binary DependencyRawData
        {
            get
            {
                return this._Msf_Col_DependencyRawData;
            }
            set
            {
                if ((this._Msf_Col_DependencyRawData != value))
                {
                    this.OnDependencyRawDataChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_DependencyRawData = value;
                    this.SendPropertyChanged("DependencyRawData");
                    this.OnDependencyRawDataChanged();
                }
            }
        }

        /// <summary>
        /// The Sub Service to which the dependency belongs
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_SubServiceID", Storage = "_Msf_Col_SubServiceID", DbType = "UniqueIdentifier NOT NULL")]
        public System.Guid SubServiceID
        {
            get
            {
                return this._Msf_Col_SubServiceID;
            }
            set
            {
                if ((this._Msf_Col_SubServiceID != value))
                {
                    this.OnSubServiceIDChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_SubServiceID = value;
                    this.SendPropertyChanged("SubServiceID");
                    this.OnSubServiceIDChanged();
                }
            }
        }

        /// <summary>
        /// The Sub Service Version to which the dependency belongs
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_Version", Storage = "_Msf_Col_Version", DbType = "NVarChar(15) NOT NULL", CanBeNull = false)]
        public string Version
        {
            get
            {
                return this._Msf_Col_Version;
            }
            set
            {
                if ((this._Msf_Col_Version != value))
                {
                    this.OnVersionChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_Version = value;
                    this.SendPropertyChanged("Version");
                    this.OnVersionChanged();
                }
            }
        }

        /// <summary>
        /// Primary key for the DTO
        /// </summary>
        public Guid KeyId { get { return DependencyID; } set { DependencyID = value; } }

        /// <summary>
        /// Created By
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_CreatedBy", Storage = "_Msf_Col_CreatedBy", DbType = "UniqueIdentifier NOT NULL")]
        public System.Guid CreatedBy
        {
            get
            {
                return this._Msf_Col_CreatedBy;
            }
            set
            {
                if ((this._Msf_Col_CreatedBy != value))
                {
                    this.OnCreatedByChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_CreatedBy = value;
                    this.SendPropertyChanged("CreatedBy");
                    this.OnCreatedByChanged();
                }
            }
        }

        /// <summary>
        /// Modified By
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_ModifiedBy", Storage = "_Msf_Col_ModifiedBy", DbType = "UniqueIdentifier")]
        public System.Nullable<System.Guid> ModifiedBy
        {
            get
            {
                return this._Msf_Col_ModifiedBy;
            }
            set
            {
                if ((this._Msf_Col_ModifiedBy != value))
                {
                    this.OnModifiedByChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_ModifiedBy = value;
                    this.SendPropertyChanged("ModifiedBy");
                    this.OnModifiedByChanged();
                }
            }
        }

        /// <summary>
        /// Created On
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_CreatedOn", Storage = "_Msf_Col_CreatedOn", DbType = "DateTime NOT NULL")]
        public System.DateTime CreatedOn
        {
            get
            {
                return this._Msf_Col_CreatedOn;
            }
            set
            {
                if ((this._Msf_Col_CreatedOn != value))
                {
                    this.OnCreatedOnChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_CreatedOn = value;
                    this.SendPropertyChanged("CreatedOn");
                    this.OnCreatedOnChanged();
                }
            }
        }

        /// <summary>
        /// Modified On
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_ModifiedOn", Storage = "_Msf_Col_ModifiedOn", DbType = "DateTime")]
        public System.Nullable<System.DateTime> ModifiedOn
        {
            get
            {
                return this._Msf_Col_ModifiedOn;
            }
            set
            {
                if ((this._Msf_Col_ModifiedOn != value))
                {
                    this.OnModifiedOnChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_ModifiedOn = value;
                    this.SendPropertyChanged("ModifiedOn");
                    this.OnModifiedOnChanged();
                }
            }
        }
        

        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
